#ifndef CDIRMODEL_H
#define CDIRMODEL_H

#include <QAbstractListModel>
#include <QFileInfoList>
#include <QDir>

class CDirModel : public QAbstractListModel
{
    Q_OBJECT

    Q_PROPERTY(QString path READ path WRITE setPath )
public:
    explicit CDirModel(QObject *parent = nullptr);
    enum FileInfoRole{
        fileName,
        filePath,
        size,
    };


    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    QHash<int, QByteArray> roleNames() const;
private:
    QString path(){return m_path;}
    void setPath(QString path);
private:
    QString m_path;
    QFileInfoList m_fileInfoList;
};

#endif // CDIRMODEL_H
